<template>
	<view>
		<view class="wrap">
			<u-swiper :list="list" :effect3d="true" name="imgPath"></u-swiper>
		</view>
		<view class="jingangqu">
			<view class="jingangquItem" @click="goMessage">
				<image :src=imgPath1 mode="" class="image"></image>
				<text>个人信息</text>
			</view>
			<view class="jingangquItem" @click="goLuntan">
				<image :src=imgPath2 mode=""  class="image"></image>
				<text>论坛</text>
			</view>
			<view class="jingangquItem" @click="goUpdataTimetable">
				<image :src=imgPath3 mode=""  class="image"></image>
				<text>更新课表</text>
			</view>
		</view>
		<view class="timetable">
			 <view class="title">
				{{weekDay}}
				<view class="title fr">第{{week}}周</view>
			</view>
			<view >
				<view class="timetableList" v-for="(item,index) in timetable" :key="index">
					<view class="timetableInfo" v-if="item.jcs!=undefined">
						<view class="timetableInfoNumber">
							<view class="top">
								{{timetableNumTop[index]}}
								
							</view>
							<view class="cen"></view>
							<view class="bot">
								{{timetableNumBot[index]}}
								
							</view>
						</view>
						<view class="timetableInfoClass">
							<view class="timetableInfoName">
								{{item.courseName}}
							</view>
							<view class="timetableInfoRoom">
								<image src="../../static/position.png" mode="aspectFit" class="fl"></image>
								{{item.place}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="recommend">
			<view class="text">
				精彩推荐
			</view>
			<view class="recommendItem" v-for="item in 1" :key="item">
				<view class="title">
					混元太极门
				</view>
				<view class="content">
					今天跟着马老师学习，很开心
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token:uni.getStorageSync('token'),
				imgPath1:"../../static/information.png",
				imgPath2:"../../static/sendtext.png",
				imgPath3:"../../static/setting.png",
				link1:"../timetable/timetableInfo",
				link2:"",
				link3:"",
				list: [
				],
				weekDay: '',
				weekNum: ['第一周','第二周','第三周','第四周','第五周','第六周','第七周','第八周','第九周','第十周','第十一周','第十二周','第十三周','第十四周','第十五周','第十六周','第十七周','第十八周','第十九周','第二十周','第二十一周','第二十二周','第二十三周','第二十四周','第二十五周'],
				week:0,
				timetableNumTop: ['01', '03', '05', '07', '09'],
				timetableNumBot: ['02', '04', '06', '08', '10'],
				timetable: []
			}
		},
		onLoad() {
			this.getBanner()
			this.getTableToday()
			this.getWeek()
		},
		methods:{
			getBanner(){
				uni.request({
					url: 'https://wesl.nekolab.tech/sp/v1/index/banner',
					method: 'GET',
					data:{
						token:this.token
					},
					success: (res) => {
						     this.list=res.data.data.banner
							
					}
				})
			},
			getTableToday(){
				uni.request({
					url: 'https://wesl.nekolab.tech/v1/table/today',
					method: 'POST',
					header: {
						'content-type':"application/x-www-form-urlencoded"
					},
					data:{
						token:this.token
					},
					success: (res) => {
						if(res.data.code==200){
							this.timetable=res.data.data
						}
					}
				})
			},
			getWeek(){
				uni.request({
					url: 'https://wesl.nekolab.tech/v1/table/week',
					method: 'POST',
					header: {
						'content-type':"application/x-www-form-urlencoded"
					},
					data:{
						token:this.token
					},
					success: (res) => {
						this.week=res.data.data.week
					}
				})
				var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; 
				 var nowDate=new Date().toISOString()
				var myDate = new Date(Date.parse(nowDate));  
				console.log(weekDay[myDate.getDay()]);   
				this.weekDay=weekDay[myDate.getDay()]
			},
			goMessage(){
				uni.navigateTo({
					url:"../mine/information"
				})
			},
			goLuntan(){
				uni.switchTab({
					url:'../sendtext/sendtext'
				})
			},
			goUpdataTimetable(){
				uni.navigateTo({
					url:"../mine/setting"
				})
			}
		
		}
	}
</script>

<style scoped lang="scss">
	.recommend{
		background-color: white;
		border-radius: 24rpx;
		margin-left: 36rpx;
		margin-right: 36rpx;
		padding: 10rpx 0;
		border: 1px solid #dbdbdb;
		.text{
			margin-top: 10rpx;
			font-size: 30rpx;
			font-weight: 900;
			margin-left: 20rpx;
			margin-right: 20rpx;
			border-bottom: 1px solid #dbdbdb;
			padding-bottom: 10rpx;
			
		}
		.title{
			margin-left: 15rpx;
			font-size: 25rpx;
		}
		.content{
			margin-left: 15rpx;
			margin-right: 15rpx;
			font-size: 25rpx;
			border-bottom: 2rpx solid #d0d0d0;
		}
	}
	.jingangqu{
		display: flex;
		justify-content: space-around;
		background-color: white;
		border-radius: 24rpx;
		margin-left: 36rpx;
		margin-right: 36rpx;
		padding: 10rpx 0;
		border: 1px solid #dbdbdb;
		.jingangquItem{
			display: flex;
			flex-direction: column;
			align-items: center;
			image{
				width: 80rpx;
				height: 80rpx;
			}
			text{
				margin-top: 10rpx;
				font-size: 25rpx;
				color: $u-main-color;
			}
		}
		}
	.fl {
		float: left;
	}

	.fr {
		float: right;
		font-weight: 400;
	}

	.wrap {
		padding: 36rpx 24rpx;
		border-top: 4rpx solid #dbdbdb;
	}

	.timetable {
		background-color: white;
		margin: 36rpx 5%;
		border-radius: 24rpx;
		border: 2rpx solid #dbdbdb;
		padding: 0 8%;
	}

	.title {
		height: 100rpx;
		line-height: 100rpx;
		border: 20rpx;
		font-weight: 700;
	}

	.timetableInfo {
		display: flex;
		border-top: 4rpx solid #dbdbdb;
	}

	.timetableInfoNumber {
		flex: 1;
		text-align: center;
		font-size: 24rpx;
	}

	.timetableInfoNumber .top,
	.timetableInfoNumber .bot {
		line-height: 48rpx;
	}

	.timetableInfoNumber .cen {
		height: 20rpx;
		width: 4rpx;
		margin: auto;
		background-color: #dbdbdb;
	}

	.timetableInfoClass {
		flex: 8;
	}

	.timetableInfoName {
		padding: 16rpx 0 0 16rpx;
		font-weight: 700;
		font-size: 30rpx;
	}

	.timetableInfoRoom {
		line-height: 60rpx;
		font-size: 26rpx;
	}

	.timetableInfoRoom image {
		height: 50rpx;
		width: 60rpx;
	}

</style>
